﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using nsDalLayer;
using System.Data;
public partial class WebControls_Item : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       // itemDetail();
    }
    clsSubItem SubItem;
    clsSubItemPRP SubItemPrp;
    private void itemDetail()
    {
       SubItem = new  clsSubItem();
        DataSet ds = new DataSet();
        var a = SubItem.LastInserted_SubItem();

        grditemDetial.DataSource = a;
        grditemDetial.DataBind();
 
    }
    private void itemListBind()
    {//select top 1 * from tbItems order by ItemID desc
        SubItem = new clsSubItem();
        DataSet ds = new DataSet();

    }
    protected void additem_Click(object sender, EventArgs e)
    {
        try
        {
            SubItem = new clsSubItem();
            SubItemPrp = new clsSubItemPRP();
            SubItemPrp.SubItem_ItemID = Convert.ToInt32(Request.QueryString["ItemID"]);
            SubItemPrp.SubItemTitle = txtitemTitle.Text;
            SubItemPrp.SubItemTag=txtitemTag.Text;
            SubItemPrp.SubItemDsc = txtitemDsc.Text;
            string ImagePathFolder = "ImagePath/" + ImageUploder.FileName;
            string ImageThumbFolder = "ThumbPath/" + ImageUploder.FileName;
            string dataFile = "../ThumbPath/" + ImageUploder.FileName;
            string dataFile1 = "../ImagePath/" + ImageUploder.FileName;
            ImageUploder.SaveAs(Server.MapPath(dataFile));
            ImageUploder.SaveAs(Server.MapPath(dataFile1));
            SubItemPrp.SubItemThumbPath = ImageThumbFolder;
            SubItemPrp.SubItemImagePath = ImagePathFolder;
            SubItem.save_rec(SubItemPrp);
            itemDetail();
        }
        catch(Exception ex)
        {
     
        }

    }
}